import { ChangeDetectionStrategy, Component } from '@angular/core';
import { G2MiniAreaData } from '@delon/chart/mini-area';
@Component({
  selector: 'st-widget-g2-mini-area',
  template: `<g2-mini-area borderColor="#13C2C2" line height="50" [data]="genData()" [animate]="true"></g2-mini-area>`,
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class STG2MiniAreaWidget {
  static readonly KEY = 'g2-mini-area';

  visitData!: any[];

  genData(): G2MiniAreaData[] {
    let fData: G2MiniAreaData[] = [];
    this.visitData.forEach(item => {
      fData.push({
        x: item['date'],
        y: item['grand_total']
      });
    });
    console.log(fData);
    return fData;
  }
}
